#ifndef AUDIOSYSTEM_CPP
#define AUDIOSYSTEM_CPP

#include <windows.h>
#include <mmsystem.h>
#include <iostream>
#include <cstdio>
#include <fstream>

#define NUM_OF_BUFFERS 2000

/*-------------------------------------------------------------------------------------
--
--	CLASS: AudioSystem
--
--	Date: April 1, 2010
--
--	REVISIONS (Date and Description):
--
--	DESIGNER: John Kuo
--
--	PROGRAMMER: Brad Paugh
--
--  INTERFACE: class AudioSystem
--
--  RETURNS: N/A
--
--	NOTES: Class responsible for the processing of sound data files.
--
-------------------------------------------------------------------------------------*/
class AudioSystem
{
	public:
		AudioSystem();
		void playBuffer(char* audioBuffer, int length);
		char* extractHeaderInfo(FILE* fp);
		char* extractHeaderFromPacket(char* packet);
		int getMsPerPacket(int packetSize);
        void changeVolume(DWORD volumeLevel);
		void stop();

	private:
		WAVEHDR headers[NUM_OF_BUFFERS];
		char* bufferData[NUM_OF_BUFFERS];
		HWAVEOUT audioDevice;
		WAVEFORMATEX format;
		int currentBuffer;
                DWORD currentVolume;
		char headerData[23];
};

#endif
